 	<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript">
//IE不支持console对象，此代码仅为测试使用
///////////////////////////////////////
window.console = window.console || (function () {
var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile  
= c.clear = c.exception = c.trace = c.assert = function () { };  
return c;  
})();  
$(window).resize(function () { 
	
	 var framHeight = window.parent.frames["leftFrame"].frameElement.contentWindow.document.documentElement.scrollHeight*1;
	  if(document.body.scrollHeight*1 > framHeight){
		  framHeight = document.body.scrollHeight;
	  }
	  $("#setDivBtn_id").css("height",framHeight+"px");
	  
	  $("#btn_id").css("top",(window.screen.availHeight-300)/2+"px");
});
Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "H+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
$(function(){
    parentWindow =  parent//设置外部宽度
	$.ajax({
	      url:'<%=path%>/DrivingSys/left/getUserMenu.action',
	      type: "post",  
	      dataType:"json",
	      data:{}, 
	      success: function(json) {
              var date1=new Date();  //开始时间
	    	  var tmp=[];
	    	  tmp = tree(json,tmp,1);
	    	  var str = '';
	    	  for(var i =0;i<tmp.length;i++){
	    		  if(tmp[i].leavel == 1){
	    			  var menuImg = tmp[i].imgUrl;
	    			  if(menuImg == null || menuImg == 'null'){
	    				  str+='<dd><div class="title"><span style="padding-top: 3px">'+
		    			  '<img  /></span>&nbsp;&nbsp;'+tmp[i].menuName+'<img class="selIcon"src="<%=path%>/images/index/xx.png" /></div>';
	    			  }else{
	    				  str+='<dd><div class="title"><span style="padding-top: 3px">'+
		    			  '<img src="'+menuImg+'" style="width:20px;height:20px" /></span>&nbsp;&nbsp;'+tmp[i].menuName+'<img class="selIcon" src="<%=path%>/images/index/xx.png" /></div>';
	    			  }
	    		  }else if(tmp[i].leavel == 2){
	    			  //子菜单
	    			  if(tmp[i].menuType == 'nav'){
	    				  //上一个菜单是子菜单 加li
	    				  if(tmp[i-1].menuType == 'nav'){
	    					  str+='<li mid="tab'+tmp[i].id+'" funurl="<%=path%>/DrivingSys'+tmp[i].menuUrl+'"><cite></cite><a>'+ tmp[i].menuName + '</a><i></i></li>';
	    				  }else{
		    				  str+='<ul class="menuson"><li mid="tab'+tmp[i].id+'" funurl="<%=path%>/DrivingSys'+tmp[i].menuUrl+'"><cite></cite><a>'+ tmp[i].menuName + '</a><i></i></li>';
	    				  }
	    				  //最后一个
	    				  if(i==tmp.length-1){
	    					  str+='</ul></dd></dl>';
	    				  }else{
	    					  //判断下一个菜单是否是子菜单
	    					  if(tmp[i+1].menuType == 'sys'){
	    						  //如果下一个父菜单是二级菜单关闭当前。
	    						  if(tmp[i+1].leavel == 2){
	    							  str+='</ul>';
	    						  }else{
	    							  str+='</ul></dd>';
	    						  }
	    						  
	    					  }
	    				  }
	    				   //'</dd>';
	    			  }else{
	    				  if(tmp[i-1].menuType == 'sys'){
    						  //如果下一个父菜单是二级菜单关闭当前。
    						  if(tmp[i-1].leavel != 3){
    							  str+='<ul class="menuson">';
    						  }
    						  
    					  }
	    				  str+='<li class="showi"><cite></cite><a href="javascript:;" >'+tmp[i].menuName+'</a></li>'
	    			  }
	    			  
	    			  
	    		  }else if(tmp[i].leavel == 3){
	    			  if(tmp[i-1].menuType == 'nav'){
    					  str+='<li mid="tab'+tmp[i].id+'" funurl="<%=path%>/DrivingSys'+tmp[i].menuUrl+'"><a style="margin-left:35px">'+tmp[i].menuName+'</a></li>';
    				  }else{
    					  
	    				  str+='<ul class="type"><li mid="tab'+tmp[i].id+'" funurl="<%=path%>/DrivingSys'+tmp[i].menuUrl+'"><a style="margin-left:35px">'+tmp[i].menuName+'</a></li>';
    				  }
	    			//最后一个
    				  if(i==tmp.length-1){
    					  str+='</ul></ul></dd>';
    				  }else{
    					  //判断下一个菜单是否是子菜单
    					  if(tmp[i+1].menuType == 'sys'){
    						  if(tmp[i+1].leavel == 2){
    							  str+='</ul>';
    						  }else{
    							  str+='</ul></ul></dd>';
    						  }
    					  }else{
    						  if(tmp[i+1].parentId != tmp[i].parentId){
    							  str+='</ul>';
    						  }
    					  }
    				  }
	    		  }
	    		  //if(tmp[i].menuType == '')
	    	  }
	    	  ////////////////////////////////////
	    	  				//插入//
	    	  ////////////////////////////////////
	    	  $("#menu_list_id").append(str);
              var date2=new Date();    //结束时间
              var date3=date2.getTime()-date1.getTime()  //时间差的毫秒数
	    	  ////////////////////////////////////
	    	  		  ////为菜单添加点击事件////
	    	  ////////////////////////////////////
	    	  //二级菜单
	    	  $(".menuson li").click(function(){
	    			$(".menuson li.active").removeClass("active")
	    			$(this).addClass("active");
	    	  });
	    		
	    	  $('.title').click(function(){
	    			var $ul = $(this).next('ul');
	    			$('dd').find('ul').slideUp();
	    			$('.selIcon').attr("src",'<%=path%>/images/index/xx.png');
	    			if($ul.is(':visible')){
	    				$(this).next('ul').slideUp();	
	    				$(this).find(".selIcon").attr("src",'<%=path%>/images/index/xx.png');
	    			}else{
	    				$(this).find(".selIcon").attr("src",'<%=path%>/images/index/xs.png');
	    				$(this).next('ul').slideDown();
	    			}
	    	  });
    		  //三级菜单
    		  $('.showi').live('click',function(){
    			 var $ul=$(this).next();
    			 if($ul.is(':visible')){
    				 $(".type").hide();
    				 $(this).next('ul').slideUp();	
    			 }else{
    				 $(".type").hide();
    				 $(this).next('ul').slideDown();
    			 }
    		  });
             /* parentWindow.setWindow.rows="80,*,45";*/
              var date4=new Date();    //结束时间
              var date5=date4.getTime()-date1.getTime()  //时间差的毫秒数
    		  var framHeight = window.parent.frames["leftFrame"].frameElement.contentWindow.document.documentElement.scrollHeight*1;
    		  if(document.body.scrollHeight*1 > framHeight){
    			  framHeight = document.body.scrollHeight;
    		  }
    		  $("#btn_id").removeClass("hideClass");
    		  //$("#setDivBtn_id").css("height",(window.screen.availHeight-300)+"px");
    		  $("#setDivBtn_id").css("height",framHeight+"px");
    		  
    		  $("#btn_id").css("top",(window.screen.availHeight-300)/2+"px");
    		/*  parentWindow.setyou1.cols="285,*";*/
             /* $(parent.frames["rightFrame"].document).find(".head").fadeToggle()
              $(parent.frames["rightFrame"].document).find(".loading").fadeToggle()*/
              /*alert($(parent.frames["rightFrame"].document).find(".head").show())*/
	      },error:function(){
	      }

	 });

})
function tree(data,tmp,num){
	//debugger;
	for (var i = 0; i < data.length; i++) {
		//循环 对象
		var data2 = data[i];
		if(data2.menuType !='power'){
			if (data2.children != null && data2.children.length > 0) {
				data2["level"] = num;
				tmp.push(data2);
					tree(data2.children,tmp,num+1);
	        }else{
	        	data2["level"] = num;
	        	tmp.push(data2);
	        }
		}
	}
	return tmp;
}
$(document).ready(function(){
	$(".type").hide();
    /*$('a').live('click',function () {
        var str = '<a href=' +$(this).attr('href')+ '  target="rightFrame">'+$(this).html()+'</a>'
        $(parent.frames["topFrame"].document).find("body").append(str)
    })*/
})
function setWidth(str){
	var flag = $("#btn_id").attr("set-btn-flag");
	if(str != null && str !=''&&str != undefined && str !='undefined'){
		flag = str;
	}
	if(flag == "N"){
        document.body.style.overflow = "hidden"; //隐藏滚动条

		parent.setyou1.cols="40,*";//设置外部宽度
		$(".closeClass").removeClass("hideClass");//隐藏div
		$(".closeClass").addClass("hideClass");//隐藏div
		$(".openClass").addClass("hideClass");//隐藏div
		$(".openClass").removeClass("hideClass");//隐藏div
		$("#menu_list_id").addClass("hideClass");//隐藏div
		$("table").css("width","35px");//设置宽度
		$("#btn_id").attr("set-btn-flag","Y");//设置标记为Y
		$("#btn_id").find("span").text("展开");
	}else{
        document.body.style.overflow = "visible"; //显示滚动条

		parent.setyou1.cols="285,*";//设置外部宽度
		$(".openClass").removeClass("hideClass");//隐藏div
		$(".openClass").addClass("hideClass");//隐藏div
		$(".closeClass").addClass("hideClass");//隐藏div
		$(".closeClass").removeClass("hideClass");//隐藏div
		$("#btn_id").find("span").text("收缩");
		$("#menu_list_id").removeClass("hideClass");//隐藏div
		$("table").css("width","277px");//设置宽度
		$("#btn_id").attr("set-btn-flag","N");//设置标记为Y
	}
}
$('li:not(".showi")').live('click',function () {
    var li = $(this);
    var menuId = $(li).attr('mid');
    var url = $(li).attr('funurl');
    var title =$(this).find('a').html();
    window.parent.document.getElementById('rightFrame').contentWindow.goToMessage(menuId,title,url)
})
</script>

<style type="text/css">
body{min-width:16px;max-height: 700px}
.leftmenu{width: 250px;margin: 0;padding: 0}
.title{background: #3b4966;height: 48px;line-height: 48px;font-size: 16px;color: #a9bbe0;border-bottom:1px solid #4f5c76;padding-left: 35px}
a, a:focus{color: #fff;font-size: 14px}
a:hover {color: #57a0ff;}
.admin-bottom{position: fixed;bottom: 0;background: #3c4351;height: 45px;}

.menuson li {
	padding-left: 20px;
}
.menuson li cite{padding-left: 15px;background: url(<%=path%>/images/index/sjxmr.png) no-repeat;margin-top: 11px;}
 cite {background: #a9bbe0;}
.menuson li.active cite{padding-left: 15px;background: url(<%=path%>/images/index/sjxdj.png) no-repeat;margin-top: 11px;}
.menuson li.active{background: url(<%=path%>/images/index/libag.jpg) no-repeat;}
.selIcon{float: right;padding-top: 20px;padding-right: 20px;}
.leftmenu dd:first-child .menuson{display: none;}
.type{padding-left: 15px}
.menuson{background: #34425e;}
.menuson li.active a{color: #34425e;}
.hideClass{display:none}
/* 菜单右边框 */
.leftmenu dd{background:url(<%=path%>/images/leftmenubg.gif) repeat-x;line-height:35px;font-weight:bold;font-size:14px;border-right:solid 1px #b7d5df;}
.openClass{margin:5px 0}
.openClass{margin:5px 0}
/* 设置滚动条的样式 */
::-webkit-scrollbar {
	width: 5px;
}

/* 滚动槽 */
::-webkit-scrollbar-track {
	-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
	border-radius: 10px;
}

/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.1);
	-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
}

::-webkit-scrollbar-thumb:window-inactive {
	background: rgba(255, 0, 0, 0.4);
}
*{margin:0;padding: 0}
</style>

</head>
<body style="background:#fff;">
<!-- 	<div class="lefttop"><span></span>车生活</div> -->
<table style="width:278px;background:#3b4966;">
		<tr>
			<td valign="top">
			    <div >
				    <dl class="leftmenu"id="menu_list_id">
				    </dl>
			    </div>
			</td>
			<td align="center" style="background: #fff">
				<div style="float: right;width:30px;font-size: 15px;background: #fff" id="setDivBtn_id">
					<div style="position: relative;cursor:pointer;top:20px;width: 25px"id="btn_id"class="hideClass"onclick="setWidth()" set-btn-flag="N">
		    			<img class="openClass hideClass" src="<%=path%>/images/myimages/openMenu.jpg"width="15px"/>
						<img class="closeClass" src="<%=path%>/images/myimages/closeMenu.jpg"width="15px"/>
						<span style="font-size: 15px;">收缩</span>
						<img class="openClass hideClass" src="<%=path%>/images/myimages/openMenu.jpg"width="15px"/>
		    			<img class="closeClass" src="<%=path%>/images/myimages/closeMenu.jpg"width="15px"/>
					</div>
		    	</div>
		    	
			</td>
		</tr>
	</table>
</body>
</html>
